package com.example.chatgptapplication.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.chatgptapplication.common.bean.BaseEntity;
import com.example.chatgptapplication.entity.SysOperLog;
import com.example.chatgptapplication.mapper.SysOperLogMapper;
import com.example.chatgptapplication.service.SysOperLogService;
import org.springframework.stereotype.Service;

@Service
public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOperLog> implements SysOperLogService {


    @Override
    public void saveLog(SysOperLog sysOperLog) {
        save(sysOperLog);
    }

    @Override
    public Page<SysOperLog> getSysOperLog(SysOperLog sysOperLog) {
        Page<SysOperLog> page = getPageData(sysOperLog);
        return this.page(page);
    }

    public Page<SysOperLog> getPageData(BaseEntity baseEntity){
        Integer pageNum = baseEntity.getPageNum();
        Integer pageSize = baseEntity.getPageSize();
        Page<SysOperLog> page = new Page<>(pageNum,pageSize);
        return page;
    }


}
